#ifndef _AOBJECT_H_
#define _AOBJECT_H_

#include "common.hpp"
#include <queue>
#include <map>
#include <list>
#include <iostream>

class			AObject
{
public:
  typedef std::map<unsigned int, std::pair<AObject*, bool> >*		LinkChain;
  typedef std::map<unsigned int, std::pair<AObject*, bool> >::iterator	LinkChainIterator;

  enum			type
    {
      OPERATOR = 0,
      FACT,
      NOT,
      EQUAL
    };
protected:
  unsigned int		_id;
  state			_state;
  std::queue<AObject*>	_cond;
  bool			_linked;
  type			_type;

public:
  AObject();
  unsigned int		getId() const;
  type			getType() const;
  virtual void		solve() = 0;
  void			addObject(AObject*);
  state			getState() const;
  virtual bool		link(LinkChain, LinkChainIterator);
  virtual bool		behaviour(LinkChain, LinkChainIterator, LinkChainIterator, LinkChainIterator);
  virtual void		getRequiredLinks(LinkChain, LinkChainIterator, LinkChainIterator);

  virtual ~AObject(){};
};

#endif /* _AOBJECT_H_ */
